package com.jweb.framework.core.impl;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import com.jweb.framework.core.UserEx;


public class DefaultUser implements UserEx {

	
	private static final long serialVersionUID = -7505111049336350236L;
	
	private Locale locale ; 
	private String cifId ; 
	private String userId ; 
	private String uniqueId ; 
	private String UUID ; 
	private String name ; 
	private String roles[] ; 
	private boolean logined = true ;
	private String state ;
	private Map attributes = new HashMap(7) ; 
	
	public DefaultUser() {
	
	}

	public boolean isLogined() {
		return this.logined ;
	}

	public void setLogined(boolean flag) {
		this.logined = flag;
	}

	public String getState() {
		return this.state ;
	}

	public void setState(String s) {
		this.state = s;
	}

	public void setAttribute(String s, Object obj) {
		this.attributes.put(s, obj);
	}

	public void setCifId(String s) {
		this.cifId = s;
	}

	public void setLocale(Locale locale) {
		this.locale = locale;
	}

	public void setName(String s) {
		this.name = s;
	}

	public void setRoles(String as[]) {
		this.roles = as;
	}

	public void setUniqueId(String s) {
		this.uniqueId = s;
	}

	public void setUUID(String s) {
		this.UUID = s;
	}

	public void setUserId(String s) {
		this.userId = s;
	}

	public Object getAttribute(String s) {
		return this.attributes.get(s);
	}

	public Map getAttributes() {
		return this.attributes ;
	}

	public String getCifId() {
		return this.cifId ;
	}

	public Locale getLocale() {
		return this.locale ;
	}

	public String getName() {
		return this.name ;
	}

	public String[] getRoles() {
		return this.roles ;
	}

	public String getUniqueId() {
		if (this.uniqueId == null)
			this.uniqueId = this.cifId != null ? (new StringBuilder(String.valueOf(this.userId))).append("@")
					.append(this.cifId).toString() : this.userId ;
		return this.uniqueId ;
	}

	public String getUserId() {
		return this.userId ;
	}

	public String getUUID() {
		return this.UUID ;
	}

}
